﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
using System.Windows.Forms;

namespace LevelEditor.Util
{
    class RectangleDrawer
    {
        private static RectangleDrawer _rectDrawer;


        RectangleDrawer()
        {
        }

        public static RectangleDrawer Instance()
        {
            if (_rectDrawer == null)
                _rectDrawer = new RectangleDrawer();

            return _rectDrawer;
        }


        public void Draw(Rectangle rect, Form frm, Color color)
        {
            SolidBrush myBrush = new SolidBrush(color);

            Graphics graphics = frm.CreateGraphics();
            graphics.FillRectangle(myBrush, rect);

            myBrush.Dispose();
            graphics.Dispose();
        }

        public void Draw(Rectangle rect, Control frm, Color color)
        {
            SolidBrush myBrush = new SolidBrush(color);

            Graphics graphics = frm.CreateGraphics();
            graphics.FillRectangle(myBrush, rect);

            myBrush.Dispose();
            graphics.Dispose();
        }
    }
}
